package com.free.testve;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.free.javadodo.jdbc.ConnectionManager;

public class TestSQL {

	public static void main(String[] args) {
		ConnectionManager mgr = new ConnectionManager(
				"com.sybase.jdbc3.jdbc.SybDriver",
				"jdbc:sybase:Tds:172.16.55.157:5000/personal?CHARSET=cp936",
				"personal", "suntek");
		Connection conn = mgr.getConnection();
		CallableStatement stmt = null;
		ResultSet rs = null;
		try {
			System.out.println("conn:" + conn);
			stmt = conn.prepareCall("sp_helpindex 'PA_ACCOUNT'");
			rs = stmt.executeQuery();
			int i = 0;
			// rs= (ResultSet)stmt.getObject(0);
			while (rs.next()) {
				System.out.print(i++ + ":");
				System.out.println(rs.getString(3));
				;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
